<?php
require_once(TEMPLATEPATH . '/inc/control.php'); 
require_once(TEMPLATEPATH . '/inc/controlpanel.php'); 
require_once(TEMPLATEPATH . '/inc/image.php'); 
function my_new_contactmethods( $contactmethods ) {
$contactmethods['twitter'] = 'Twitter';
$contactmethods['facebook'] = 'Facebook';
return $contactmethods;
}
add_filter('user_contactmethods','my_new_contactmethods',10,1);
function unregister_default_wp_widgets() { 
	unregister_widget('WP_Widget_Meta');
	unregister_widget('WP_Widget_Search'); 
} 
register_sidebars( 1,
	array( 
		'name' => 'blog-sidebar1',
		'description' => __('The sidebar widget area, used on single posts.'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>'
	) 
);
register_sidebars( 1, 
	array( 
		'name' => 'footer-column1',
			'description' => __('The footer widget area, 1st box.'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>'
	) 
);
register_sidebars( 1,
	array( 
		'name' => 'footer-column2',
			'description' => __('The footer widget area, 2nd box.'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>'
	) 
);
register_sidebars( 1,
	array( 
		'name' => 'footer-column3',
			'description' => __('The footer widget area, 3rd box.'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>'
	) 
);
register_sidebars( 1,
	array( 
		'name' => 'footer-column4',
			'description' => __('The footer widget area, 4th box.'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>'
	) 
);
register_sidebars( 1,
	array( 
		'name' => 'footer-column5',
			'description' => __('The footer widget area, 5th box.'),
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
        'after_widget' => '</div>',
        'before_title' => '<h3 class="widgettitle">',
        'after_title' => '</h3>'
	) 
);
add_theme_support( 'post-thumbnails' );
function show_active_category($text) {
	global $post;
	if( is_single() || is_category() ) {
		$categories = wp_get_post_categories($post->ID);
		foreach( $categories as $catid ) {
			$cat = get_category($catid);
			if(preg_match('#>' . $cat->name . '</a>#', $text)) {
				$text = str_replace('>' . $cat->name . '</a>', ' class="active_category">' . $cat->name . '</a>', $text);
			}
		}
	}
	return $text;
}
add_filter('wp_list_categories', 'show_active_category');
function catch_that_image() { 
global $post, $posts; 
$first_img = ''; 
ob_start(); 
ob_end_clean(); 
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); 
$first_img = $matches [1] [0]; 
if(empty($first_img)){ //Defines a default image 
$first_img = "http://img149.imageshack.us/img149/8779/curses.png"; 
} 
return $first_img; 
}
add_action('admin_head', 'my_custom_logo');
function my_custom_logo() {
   echo '
      <style type="text/css">
         #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/favicon.ico) !important; }
      </style>
   ';
} 
function custom_colors() {
   echo '<style type="text/css">#wphead{background:#000 !important;border-bottom:2px solid #900;color:#fff;text-shadow:#000 0 1px 1px;}#footer{background:#000 !important;border-top:2px solid #900;color:#ccc;}#user_info p,#user_info p a,#site-heading a,#wphead a{color:#fafafa !important;}</style>';
}
add_action('admin_head', 'custom_colors');
function remove_footer_admin () {
    echo "Thank you for creating with miloIIIIVII.";
} 
add_filter('admin_footer_text', 'remove_footer_admin'); 
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
function my_custom_dashboard_widgets() {
   global $wp_meta_boxes;
   unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
   unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
   unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
   wp_add_dashboard_widget('custom_help_widget', 'clearcut theme', 'custom_dashboard_help');
}
function custom_dashboard_help() {
   echo '<h4>clearcut options</h4>
		
        <p>Theme has enabled options, find it at<br /> 
        clearcut category options panel<br />
        where you can specify your footer options.</p>
        <h4>Widgets</h4>
        <p>Theme is widget enabled, use them.</p>
        <h4>Help</h4>
			  <p>Need more help? Contact milo317 via her <a href="http://3oneseven.com/">website</a>.</p>';
} 
function custom_login() { 
echo '<link rel="stylesheet" type="text/css" href="' . get_bloginfo('template_directory') . '/log/log.css" />'; 
}   
add_action('login_head', 'custom_login');  
function milo_body_control() { 
global $post; 
$postclass = $post->post_name;
if (is_home()) { 
echo 'id="home"'; 
} elseif (is_single()) { 
echo 'id="single" class="' . $postclass . '"';
} elseif (is_page()) { 
echo 'id="single"';
} elseif (is_category()) { 
echo 'id="single"';
} elseif (is_archive()) { 
echo 'id="single"';
} elseif (is_404()) { 
echo 'id="single"';
} elseif (is_search()) { 
echo 'id="single"'; 
} 
} 
?>